package cn.lijiguo.concurrency.part1.ch08;

/**
 * DeadLock
 * 演示死锁问题
 * @author lijiguo
 * @date 2019/12/16 11:08
 */
public class DeadLock {

    private OtherService otherService;

    public DeadLock(OtherService otherService) {
        this.otherService = otherService;
    }

    private final Object LOCK = new Object();

    public void m1() {
        synchronized (LOCK) {
            System.out.println("m1");
            otherService.s1();
        }
    }

    public void m2() {
        synchronized (LOCK) {
            System.out.println("m2");
        }
    }

}
